//
//  NSString+CZNSStringExt.m
//  tableView
//
//  Created by dllo on 16/1/8.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "NSString+CZNSStringExt.h"

@implementation NSString (CZNSStringExt)

//实现对象方法
- (CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize font:(UIFont *)font{
    NSDictionary *attrs = @{NSFontAttributeName : font};
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

//类方法
+ (CGSize)sizeWithText:(NSString *)text maxSize:(CGSize)maxSize font:(UIFont *)font{
   return [text sizeOfTextWithMaxSize:maxSize font:font];
}



+ (NSString *)getBeijingDayWithStrTime:(NSString *)time{
    
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
    NSDate *destDate = [dateFormatter dateFromString:time];

    NSDateFormatter *dayFormatter = [[NSDateFormatter alloc] init];
    [dayFormatter setDateStyle:NSDateFormatterMediumStyle];
    [dayFormatter setLocale:[NSLocale currentLocale]];

    NSString *strDate = [dayFormatter stringFromDate:destDate];


    return strDate;
}



@end















